package com.hhd.cwqs.qs.service;

import com.hhd.cwqs.qs.Params;
import com.hhd.cwqs.qs.sql.SingleConnJdbcTemplate;

public abstract class BaseMainProcessor implements MainProcessor {
    @Override
    public void process(Params param) {
        removeDatas(param);

        doImport(param);

        insertDatas(param);
    }

    protected abstract void doImport(Params param);

    private void insertDatas(Params param) {
        SingleConnJdbcTemplate targetSqlTemplate = param.getTargetSqlTemplate();
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaAccountClsList());
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaBalList());
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaVouCashflowList());
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaVouDetailList());
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaVouDetailAssList());
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaVouDiffList());
        targetSqlTemplate.saveBatch(param.getPackageData().getGlaVouHeadList());
        targetSqlTemplate.saveBatch(param.getPackageData().getMaEleProjectList());
    }


    private void removeDatas(Params param) {

    }
}
